package com.opgea.crm.web.form;

import com.opgea.crm.common.util.DateUtil;
import com.opgea.crm.domain.entities.Lead;
import com.opgea.crm.domain.entities.Leadprofile;
import com.opgea.crm.domain.entities.Opportunity;

public class LeadOppForm {
	
	private String leadId;
	private String firstName;
	private String oppLeadId;
        private Long opportunityId;
	private String opportunityTitle;
	private String dealSize;
	private String targetDate;
	private String createDate;
	private String actualCloseDate;
	private String opportunityDiscription;
	
	private String stage;
	private long stageId;
	private String status;
	private long statusId;
	private String oppClosingProbability;
	private long oppClosingProbabilityId;
	private String salesPerson;
	private long salesPersonId;
	
	
	
	
	
	public String getLeadId() {
		return leadId;
	}
	public void setLeadId(String leadId) {
		this.leadId = leadId;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getOppLeadId() {
		return oppLeadId;
	}
	public void setOppLeadId(String oppLeadId) {
		this.oppLeadId = oppLeadId;
	}
	
	public Long getOpportunityId() {
		return opportunityId;
	}
	public void setOpportunityId(Long opportunityId) {
		this.opportunityId = opportunityId;
	}
	public String getOpportunityTitle() {
		return opportunityTitle;
	}
	public void setOpportunityTitle(String opportunityTitle) {
		this.opportunityTitle = opportunityTitle;
	}
	public String getDealSize() {
		return dealSize;
	}
	public void setDealSize(String dealSize) {
		this.dealSize = dealSize;
	}
	
	public String getTargetDate() {
		return targetDate;
	}
	public void setTargetDate(String targetDate) {
		this.targetDate = targetDate;
	}
	public String getCreateDate() {
		return createDate;
	}
	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}
	public String getActualCloseDate() {
		return actualCloseDate;
	}
	public void setActualCloseDate(String actualCloseDate) {
		this.actualCloseDate = actualCloseDate;
	}
	public String getOpportunityDiscription() {
		return opportunityDiscription;
	}
	public void setOpportunityDiscription(String opportunityDiscription) {
		this.opportunityDiscription = opportunityDiscription;
	}
	
	
	public long getStageId() {
		return stageId;
	}
	public void setStageId(long stageId) {
		this.stageId = stageId;
	}
	public long getStatusId() {
		return statusId;
	}
	public void setStatusId(long statusId) {
		this.statusId = statusId;
	}
	
	public long getSalesPersonId() {
		return salesPersonId;
	}
	public void setSalesPersonId(long salesPersonId) {
		this.salesPersonId = salesPersonId;
	}

	
	public String getStage() {
		return stage;
	}
	public void setStage(String stage) {
		this.stage = stage;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	
	
	public String getOppClosingProbability() {
		return oppClosingProbability;
	}
	public void setOppClosingProbability(String oppClosingProbability) {
		this.oppClosingProbability = oppClosingProbability;
	}
	public long getOppClosingProbabilityId() {
		return oppClosingProbabilityId;
	}
	public void setOppClosingProbabilityId(long oppClosingProbabilityId) {
		this.oppClosingProbabilityId = oppClosingProbabilityId;
	}
	public String getSalesPerson() {
		return salesPerson;
	}
	public void setSalesPerson(String salesPerson) {
		this.salesPerson = salesPerson;
	}
	public LeadOppForm(){}
	
	public LeadOppForm(Opportunity opportunity)
	{
		Lead lead= opportunity.getRelatedContact();  
		
		this.setOpportunityTitle(opportunity.getOpportunityTitle());
		this.setDealSize(String.valueOf(opportunity.getDealSize()));
		if(opportunity.getConfidenceLevel()!= null)
		this.setOppClosingProbabilityId(opportunity.getConfidenceLevel().getId());
		if(opportunity.getStage()!=null)
		this.setStageId(opportunity.getStage().getId());
		if(opportunity.getOpportunityStatus()!= null)
		this.setStatusId(opportunity.getOpportunityStatus().getId());
		
		this.setOpportunityId(opportunity.getId());
		
		Leadprofile profile1 = lead.getLeadprofile();
		if(profile1.getEmployee()!= null)
                this.setSalesPersonId(profile1.getEmployee().getId());
                this.setTargetDate(DateUtil.dateToString(opportunity.getForecastClosingDate()));
                this.setCreateDate(DateUtil.dateToString(opportunity.getCreatedDate()));
                this.setActualCloseDate(DateUtil.dateToString(opportunity.getActualCloseDate()));
                String desc = new String(opportunity.getOpportunityDescription());
                this.setOpportunityDiscription(desc);
		
	}
	

}
